import axios from 'axios';
const FOUND_URL = '/found/list';

const initState = {
  programs: [
    {
      "id": "710000200012182184",
      "user": {
        "id": "110000200112054217",
        "name": "阎勇/阎勇",
        "avatar": "http://dummyimage.com/16x16"
      },
      "videoUrl": "https://www.runoob.com/try/demo_source/mov_bbb.mp4",
      "forward": 962,
      "comment": 91,
      "like": 57.7,
      "backgroundColor": "#dc79f2",
      "thumbnailUrl": "http://dummyimage.com/400x150",
      "title": "战看样场"
    }
  ]
}
const foundModel = {
  namespace: 'found',
  state: initState,
  reducers: {
    setState(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },
  },
  effects: {
    *fetchList({ callback }, { call }) {
      const { data } = yield call(axios.get, FOUND_URL);
      if (typeof callback === 'function') {
        callback(data);
      }
    },
  },
};

export default foundModel;
